package com.yanqu.road.server.manger.union.listener;

import com.yanqu.road.entity.enums.eUnionSyncType;
import com.yanqu.road.entity.union.cross.CrossUnionInfo;
import com.yanqu.road.entity.union.cross.CrossUnionMember;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.manger.ICrossUnionSyncListener;
import com.yanqu.road.server.manger.rank.RankMgr;

import java.util.List;

public class RankMgrListener implements ICrossUnionSyncListener {


    @Override
    public void notifySync(int syncType, long playerId, CrossUnionInfo unionInfo, List<CrossUnionMember> memberList) {

        if(syncType == eUnionSyncType.Normal.getValue()){
            if(unionInfo.getServerId() == GameServer.getInstance().getServerId()){
                RankMgr.changeUnionRank(unionInfo);
            }
        }
        if(syncType == eUnionSyncType.BeKick.getValue() || syncType == eUnionSyncType.QuitUnion.getValue() || syncType == eUnionSyncType.JoinUnion.getValue()){
            if(unionInfo.getServerId() == GameServer.getInstance().getServerId()){
                RankMgr.changeUnionRank(unionInfo);
            }
        }

    }

}
